<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui" xmlns:app="http://org.wsiz.vro/app"
	xmlns:appcc="http://java.sun.com/jsf/composite/components">
	<app:search data="#{films}" title="${msg.film}">
		<ui:define name="filters">
			<f:validateBean disabled="true">
				<h:panelGrid columns="2">
					<h:outputLabel for="account" value="${msg.film_account}" />
					<h:selectOneMenu id="account"
						value="#{filmSearchForm.film.account}"
						converter="#{accountConverter}">
						<f:selectItem itemValue="" itemLabel="-- Select One" />
						<f:selectItems value="#{accountRepository.find()}" var="item"
							itemLabel="#{accountConverter.print(item)}" />
					</h:selectOneMenu>

					<h:outputLabel for="title" value="${msg.film_title}" />
					<p:inputText id="title" value="#{filmSearchForm.film.title}"
						maxlength="80" />

					<h:outputLabel for="year" value="${msg.film_year}" />
					<h:panelGrid columns="4" id="year">
						<h:outputLabel for="yearRangeFrom" value="${msg.range_from}" />
						<p:inputText id="yearRangeFrom"
							value="#{filmSearchForm.yearRange.from}"
							converter="javax.faces.Integer" />
						<h:outputLabel for="yearRangeTo" value="${msg.range_to}" />
						<p:inputText id="yearRangeTo"
							value="#{filmSearchForm.yearRange.to}"
							converter="javax.faces.Integer" />
					</h:panelGrid>
				</h:panelGrid>
			</f:validateBean>
		</ui:define>

		<ui:define name="result">
			<p:column id="film_account" headerText="${msg.film_account}"
				width="30%">
				<h:outputText value="#{accountConverter.print(item.account)}" />
			</p:column>
			<p:column id="film_title" headerText="${msg.film_title}"
				sortBy="#{item.title}" width="30%">
				<h:outputText value="#{item.title}" />
			</p:column>
			<p:column id="film_year" headerText="${msg.film_year}"
				sortBy="#{item.year}" width="30%">
				<h:outputText value="#{item.year}" />
			</p:column>
			<p:column id="open" headerText="${msg.actions}" width="10%">
				<c:if test="#{not empty select and select}">
					<app:iconSelect action="select" process="@this"
						title="${filmConverter.print(item)}">
						<f:setPropertyActionListener value="#{item}"
							target="#{films.selectedRow}" />
					</app:iconSelect>
				</c:if>
				<c:if test="#{empty select or not select}">
					<app:iconEdit action="select" process="@this"
						title="${filmConverter.print(item)}">
						<f:setPropertyActionListener value="#{item}"
							target="#{films.selectedRow}" />
					</app:iconEdit>
				</c:if>
			</p:column>
		</ui:define>
	</app:search>
</ui:composition>
